import { Component } from "react"
import Com1_shouldUpdate from "./components/Com1_shouldUpdate"
import MyPureComponent from "./components/Com2_pureComponent"
import TestFn from "./components/Com3_memo做函数组件"

export default class App extends Component {
  constructor() {
    super()
    this.state = {
      n: 0,
      m: 0
    }
  }

  render() {
    const { m, n } = this.state
    return (
      <div>
        <button onClick={() => this.setState({ n: n + 1 })}>n+1</button>
        <button onClick={() => this.setState({ m: m - 1 })}>m-1</button>
        {/*  父组件更改值， 子组件测试*/}
        <Com1_shouldUpdate n={n} />
        <MyPureComponent m={m} />
        <TestFn />
      </div>
    )
  }
}
